from api.basic_api import BaseBuyerApi


class CreateTradeApi(BaseBuyerApi):
    def __init__(self,client='PC',way='BUY_NOW'):
        super().__init__()  # 继承父类属性
        self.url = f'{self.host}/trade/create'
        self.method='post'
        self.data = {
            "client": client,
            "way": way
        }
class SearchOrderApi(BaseBuyerApi):
    def __init__(self,key_words="",order_status="",page_no=1,page_size=5,start_time="",end_time=""):
        super().__init__()  # 继承父类属性
        self.url = f'{self.host}/trade/orders'
        self.method='get'
        self.params = {
            "key_words": key_words,
            "order_status": "",
            "page_no": page_no,
            "page_size": page_size,
            "start_time": start_time,
            "end_time": end_time
        }


class CancelOrderApi(BaseBuyerApi):
    def __init__(self, order_sn,reason="无"):
        super().__init__()  # 继承父类属性
        self.url = f'{self.host}/trade/orders/{order_sn}/cancel'
        self.method = 'post'
        data = {
            "reason": reason}
class ConfirmRogOrderApi(BaseBuyerApi):
    def __init__(self,order_sn):
        super().__init__()  # 继承父类属性
        self.url = f'{self.host}/trade/orders/{order_sn}/rog'
        self.method = 'post'